﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.TenderOffer
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.TenderOffer;

    public class Map_TenderOfferCfg : EntityMapping<TenderOfferCfg>
    {
        public Map_TenderOfferCfg()
        {
            Property(x => x.BgnDate);

            Property(x => x.CfgTitle, map =>
            {
                map.Length(500);
            });

            Property(x => x.EndDate, map =>
            {
            });

            Bag(x => x.Details, map =>
            {
                map.Key(keyMapper => keyMapper.Column("CfgId"));
                map.Cascade(Cascade.None);
            }, rel => rel.OneToMany());

            ManyToOne(x => x.OpUser, map =>
            {
                map.Column("OpUserId");
            });

            Property(x => x.Remark, map =>
            {
                map.Length(10000000);
            });

            Property(x => x.otherRemark, map =>
            {
                map.Length(10000000);
            });

            Property(x => x.otherMoney, map =>
            {
                map.Length(10000000);
            });

            Property(x => x.RootProjectCode, map => map.Length(40));

            Property(x => x.RootProjectOfferPrice);

            Property(x => x.TypeFlag);

            Bag(x => x.projAnnouncements, map =>
            {
                map.Table("ref_TenderOfferCfg_Announcement");
                map.Key(keyMapper => keyMapper.Column("CfgId"));
            }, rel => rel.ManyToMany(m => m.Column("nr_id")));

        }
    }
}
